<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<script type="text/javascript">

$(document).ready(function() {
	$("#mprs").sabrina({
		title: "选择人物关系", 
		height:"500", 
		width:"600", 
		element: "mprs",
		iframe: "mpr!select"
	});
 	 
	$("#mpacs").sabrina({
		title: "选择获奖关系", 
		height:"500", 
		width:"600", 
		element: "mpacs",
		iframe: "mpac!select?calendarId=<s:property value="movie.calendar.id" />"
	});
	
	$("#image").sabrina({
		title: "选择海报", 
		height:"500", 
		width:"600", 
		element: "image",
		iframe: "image!select"
	});
	
	$("#images").sabrina({
		title: "选择剧照", 
		height:"500", 
		width:"600", 
		element: "images",
		iframe: "image!select"
	});
	/*
	$("#videos").sabrina({
		title: "选择视频", 
		height:"500", 
		width:"600", 
		element: "videos",
		
		iframe: "video!select"
	});
	*/
	$("#videos").sabrina({
		title: "新建视频", 
		height:"500", 
		width:"600", 
		element: "videos",
		iframe: "video!add?video.movie.id=<s:property value="movie.id" />&video.movie.nameCn=<s:property value="movie.nameCn" escape="false" />"
	});
	
	
	
});

function callback(result){
	if(sender!="" && sender!=null){
		var elementData = document.getElementById(sender+"Data");
		var elementDisplay = document.getElementById(sender+"Display");
	
		elementData.value += result[0]+";";
		elementDisplay.innerHTML += result[1]+"<br/>";
	}
}
</script>

	<s:hidden name="movie.id"/>
	<s:hidden name="paging.currentPage"/>
	<table border="0" class="edittable">
		
		<tr class="edittable" style="color:red;font-weight:bold;">
			<td width="100px" ><s:label label="" value="片名(必填)" /></td>
			<td><s:textfield id="name" label="片名" name="movie.name" size="100"/></td>
		</tr>
		<tr>
			<td colspan="2"><span style="font-weight:bold;">以下全部可选</span></td>
		</tr>
		<tr>
			<td><s:label label="" value="中文名" /></td>
			<td><s:textfield label="中文名" name="movie.nameCn" /></td>
		</tr>
		
		<tr>
			<td><s:label value="Douban ID" /></td>
			<td><s:textfield name="movie.doubanId" /></td>
		</tr>
		<tr>
			<td><s:label value="Mtime ID" /></td>
			<td><s:textfield name="movie.mtimeId" /></td>
		</tr>
		<tr>
			<td><s:label label="" value="别名" /></td>
			<td><s:textfield  name="movie.alias" /></td>
		</tr>
		<tr>
			<td><s:label label="" value="视频" /></td>
			<td>
			
				<div class="sabrina">
					<s:textfield id="videosData" name="videosData" style="background-color:#cccccc;" readonly="true" />
					<div id="videosDisplay">
						<s:iterator value="movie.videos" status="stat">
							[<s:a href="movie!deleteVideo?movie.id=%{movie.id}&video.id=%{id}">X</s:a>]
							<s:a id="videoedit%{id}" href="javascript:void(0)">
								<s:property value="name"/>, <s:property value="provider"/> (<s:property value="typeName"/>)
							</s:a>
							<script>$("#videoedit<s:property value="id"/>").sabrina({ title: "修改视频", height:"500", width:"600", iframe: "video!edit?video.id=<s:property value="id"/>"});</script>
							
							<br/>
						</s:iterator>
					</div>
					<a id="videos" href="javascript:">新建</a>
				</div>
				
			</td>
			
		</tr>
		
		<tr>
			<td><s:label value="长度" /></td>
			<td><s:textfield name="movie.length" /> （分钟）</td>
		</tr>
		<tr>
			<td><s:label label="" value="人" /></td>
			<td>
			
				<!-- Selector Starts -->
				<div class="sabrina">
					<s:textfield id="mprsData" name="mprsData" style="background-color:#cccccc;" readonly="true" />
					<div id="mprsDisplay">
						<s:iterator value="movie.mprs">
							<s:property value="role.nameCn" />,<s:a href="person!edit?person.id=%{ person.id }"><s:property value="person.displayName" /></s:a>
							[<s:a href="movie!deleteMpr?movie.id=%{movie.id}&mpr.id=%{id}">X</s:a>]
							<br/>
						</s:iterator>
					</div>
					<a id="mprs" href="javascript:">选择</a>
				</div>
				<!-- Selector Ends -->
				
			</td>
			
		</tr>
		<tr>
			<td><s:label label="" value="上映日期" /></td>
			<td><s:textfield name="movie.datetime"> 
                  <s:param name="value" ><s:date name="movie.datetime" format="MM/dd/yyyy" /></s:param> 
             </s:textfield>	(MM/DD/YYYY)</td>		
			
		</tr>
		
		<tr>
			<td><s:label label="" value="上映日期/国家" /></td>
			<td>
			
				<div id="datetimes">
					<s:iterator value="movie.datetimes">
						<s:property value="datetime" />,<s:property value="country.nameCn" />
						[<s:a href="movie!deleteDatetime?movie.id=%{movie.id}&datetime.id=%{id}">X</s:a>]
						<br/>
					</s:iterator>
				</div>
				<s:hidden id="datetimesData" name="datetimesData" />
				[<s:a href="javascript:showDialog('datetimes!select','datetimes')">选择</s:a>]
				
			</td>
			
		</tr>
		<tr>
			<td><s:label label="" value="届" /></td>
			<td><s:select name="movie.calendar.id" list="calendars" listKey="id" listValue="displayName"></s:select></td>
			
		</tr>
		<tr>
			<td><s:label label="" value="奖项" /></td>
			<td>
				
				<!-- Selector Starts -->
				<div class="sabrina">
					<s:textfield id="mpacsData" name="mpacsData" style="background-color:#cccccc;" readonly="true" />
					<div id="mpacsDisplay">
						<s:iterator value="movie.mpacs" status="stat">
							<s:property value="calendar.nameCn" />,
							<s:property value="award.nameCn" />,
							<s:property value="person.displayName" /> (<s:if test="type==1">提名</s:if><s:elseif test="type==2">获奖</s:elseif>)
							[<s:a href="movie!deleteMpac?movie.id=%{movie.id}&mpac.id=%{id}">X</s:a>]
							<br/>
						</s:iterator>
					</div>
					<a id="mpacs" href="javascript:">选择</a>
				</div>
				<!-- Selector Ends -->
			</td>
		</tr>
		<tr>
			<td><s:label label="" value="类型" /></td>
			<td><s:checkboxlist name="categoriesSelected" list="categories" listKey="id" listValue="nameCn"></s:checkboxlist></td>
			
		</tr>
		<tr>
			<td><s:label label="" value="地区" /></td>
			<td><s:checkboxlist name="countriesSelected" list="countries" listKey="id" listValue="nameCn"></s:checkboxlist></td>
			
		</tr>
		<tr>
			<td><s:label label="" value="语言" /></td>
			<td><s:checkboxlist name="languagesSelected" list="languages" listKey="id" listValue="nameCn"></s:checkboxlist></td>
			
		</tr>
		<tr>
			<td><s:label label="" value="海报" /></td>
			<td>
				<div class="sabrina">
					<s:textfield id="imageData" name="movie.image.id" style="background-color:#cccccc;" readonly="true" />
					<div id="imageDisplay">
						<img src="<s:property value="movie.image.src"/>" class="thumb" /> 
					</div>
					<a id="image" href="javascript:">选择</a>
				</div>
			</td>
		</tr>
		<tr>
			<td><s:label label="" value="剧照" /></td>
			<td>
				<div class="sabrina">
					<s:textfield id="imagesData" name="imagesData" style="background-color:#cccccc;" readonly="true" />
					<div id="imagesDisplay">
						<s:iterator value="movie.images" status="stat">
						<img src="<s:property value="src"/>" class="thumb" />[<s:a href="movie!deleteImage?movie.id=%{movie.id}&image.id=%{id}">X</s:a>]
					</s:iterator>
					</div>
					<a id="images" href="javascript:">选择</a>
				</div>
			</td>
		</tr>
		

		<tr>
			<td><s:label label="" value="音乐" /></td>
			<td>
			<div id="musics"><s:iterator value="movie.musics" status="stat">
				<s:property value="displayName" />[<s:a href="movie!deleteVideo?movie.id=%{movie.id}&video.id=%{id}">X</s:a>]
			</s:iterator></div>
			[<s:a href="javascript:showDialog('music!select','musics')">+</s:a>]
			<s:hidden id="musicsData" name="musicsData" /></td>
			
		</tr>
		<tr>
			<td><s:label label="" value="剧情" /></td>
			<td><s:textarea label="剧情" name="movie.plot" cols="60" rows="5" style=""></s:textarea></td>
		</tr>
	</table>

<script>
var v = document.getElementById("name");
v.focus();
//v.value=window.clipboardData.getData("text");
</script>